import request from "../../api/request";
const market = "market";

// 获取表单数据
export function getListed(data) {
  return request({
    url: market + "/billSectPrice/listBillSectPriceByPage",
    method: "post",
    data: data || {}
  });
}

//  添加数据接口
export function addListData(data) {
  return request({
    url: market + "/billSectPrice/save",
    method: "post",
    data: data || {}
  });
}

//  修改数据接口
export function updateList(data) {
  return request({
    url: market + "/billSectPrice/update",
    method: "post",
    data: data || {}
  });
}

//  删除接口数据
export function delData(params) {
  return request({
    url: market + "/billSectPrice/remove",
    method: "delete",
    data: params
  });
}
// 文件导出接口

export function exportSectPrice(data) {
  return request({
    url: market + "/billSectPrice/exportSectPrice",
    method: "post",
    data: data || {}
  });
}
// 新增明细--获取表单接口
export function getListS(data) {
  return request({
    url: market + "/billSectPric/listBillSectPriceByPag",
    method: "post",
    data: data || {}
  });
}
// 新增明细--添加接口
export function addListDataNew(data) {
    return request({
      url: market + "/billSectPric/save",
      method: "post",
      data: data || {}
    });
  }
// 新增明细--修改接口
export function updateListNew(data) {
    return request({
      url: market + "/billSectPric/update",
      method: "post",
      data: data || {}
    });
  }
// 新增明细--删除和批量删除接口
export function delDataNew(params) {
    return request({
      url: market + "/billSectPric/remove",
      method: "delete",
      data: params
    });
  }

// 新增明细-- 文件导出接口
export function exportSectPriceDt(data) {
  return request({
    url: market + "/billSectPric/exportSectPriceDt",
    method: "post",
    data: data || {}
  });
}
// 时间格式化
export function formatDateTime(data) {
    if (data == null) {
      return "";
    }
    let dt = new Date(data);
    return (
      dt.getFullYear() +
      "-" +
      (dt.getMonth() + 1 < 10 ? "0" + (dt.getMonth() + 1) : dt.getMonth() + 1) +
      "-" +
      (dt.getDate() < 10 ? "0" + dt.getDate() : dt.getDate()) +
      " " +
      (dt.getHours() < 10 ? "0" + dt.getHours() : dt.getHours()) +
      ":" +
      (dt.getMinutes() < 10 ? "0" + dt.getMinutes() : dt.getMinutes())  +
      ":" +
      (dt.getSeconds() < 10 ? "0" + dt.getSeconds() : dt.getSeconds())
    );
  }
  export function formatDateTimes(data) {
    if (data == null) {
      return "";
    }
    let dt = new Date(data);
    return (
      dt.getFullYear() +
      "-" +
      (dt.getMonth() + 1 < 10 ? "0" + (dt.getMonth() + 1) : dt.getMonth() + 1) +
      "-" +
      (dt.getDate() < 10 ? "0" + dt.getDate() : dt.getDate())
    );
  }